var config = require('config-lite');

var env = process.env.NODE_ENV || 'development';


var log4js = require('log4js');
log4js.configure({
  appenders: [{
    type: 'console'
  }, {
    type: 'file',
    filename: 'logs/cheese.log',
    category: 'cheese'
  }, {
    type: 'dateFile',
    filename: 'logs/access.log',
    pattern: '-yyyy-MM-dd.log',
    alwaysIncludePattern: true,
    category: 'access'
  }]
});

var logger = log4js.getLogger('cheese');
logger.setLevel(config.debug && env !== 'test' ? 'DEBUG' : 'ERROR');

module.exports = logger;
